
package metadatabrowser;

import at.fhj.itm.metadata.Sequence;
import at.fhj.util.Pair;
import java.util.ArrayList;
import java.util.List;
import org.eclipse.jface.viewers.IStructuredContentProvider;
import org.eclipse.jface.viewers.Viewer;

/**
 *
 * @author Seuchter
 */
public class SequenceContentProvider implements IStructuredContentProvider{

    @Override
    public Object[] getElements(Object o)
    {
        if(!(o instanceof Sequence))
        {
            return null;
        }

        Sequence seq = (Sequence) o;

        List<Pair<String,String>> properties = new ArrayList<Pair<String, String>>();
        properties.add(new Pair<String, String>("Name", seq.getName()));
        properties.add(new Pair<String, String>("Min Value", String.valueOf(seq.getMinValue())));
        properties.add(new Pair<String, String>("Max Value", String.valueOf(seq.getMaxValue())));
        properties.add(new Pair<String, String>("Current Value", String.valueOf(seq.getCurrentValue())));
        properties.add(new Pair<String, String>("Step", String.valueOf(seq.getIncrementStep())));

        return properties.toArray();


    }

    @Override
    public void dispose()
    {

    }

    @Override
    public void inputChanged(Viewer viewer, Object o, Object o1)
    {

    }

}
